package com.gome.axwl.aoc.service.impl;

import com.gome.axwl.aoc.dao.FileUploadRecordDao;
import com.gome.axwl.aoc.entity.po.FileUploadRecordParamPo;
import com.gome.axwl.aoc.entity.po.FileUploadRecordPo;
import com.gome.axwl.aoc.service.FileUploadRecordService;
import com.gome.datasource.shard.annotation.ReadDatasource;
import com.gome.datasource.shard.annotation.WriteDatasource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description:
 * @Auther: yinyuxin@gome.com.cn
 * @Date: 2018/7/16 14:14
 */
@Service("fileUploadRecordService")
public class FileUploadRecordServiceImpl implements FileUploadRecordService {

    @Autowired
    private FileUploadRecordDao fileUploadRecordDao;

    @Override
    @ReadDatasource
    public List<FileUploadRecordPo> queryByFileScenesAndSencesId(String fileScenes, Integer scenesId) {
        return fileUploadRecordDao.queryByFileScenesAndSencesId(fileScenes,scenesId);
    }

    @Override
    @WriteDatasource
    public void batchDeleteByScenesAndSencesId(String fileScenes, Integer scenesId) {
        fileUploadRecordDao.batchDeleteByScenesAndSencesId(fileScenes,scenesId);
    }

    @Override
    @WriteDatasource
    public void deleteById(Integer id) {
        FileUploadRecordPo fileUploadRecordPo=new FileUploadRecordPo();
        fileUploadRecordPo.setId(id);
        fileUploadRecordPo.setDeletedStatus((byte)0);
        fileUploadRecordDao.updateByPrimaryKeySelective(fileUploadRecordPo);
    }

    @Override
    @WriteDatasource
    public void batchInsert(List<FileUploadRecordPo> fileUploadRecordPos) {
        fileUploadRecordDao.batchInsert(fileUploadRecordPos);
    }

    @Override
    @WriteDatasource
    public void insert(FileUploadRecordPo fileUploadRecordPo) {
        fileUploadRecordDao.insertSelective(fileUploadRecordPo);
    }


}
